
//在webpack模块是如何生产创建的
//AsyncSeriseBailHook 异步串行带保险的钩子
let {AsyncSeriesBailHook} = require('tapable')
//根据模块描述，生产模块,factorize其实表示生成模块的过程
let factorize = new AsyncSeriesBailHook(['moduleName']);//解析信息：模块路径  
//注册事件
factorize.tapAsync('exteralModuleFactory',(moduleName,callback)=>{
    if(moduleName === 'jquery'){
        callback(null,{type:'exteralModule',name:'jquery'})
    }else{
        callback(null)
    }
})

factorize.tapAsync('normalModule',(moduleName,callback)=>{
    callback(null,{type:'normalModule',name:'jquery'})
})

factorize.callAsync('jquery',(err,module)=>{
    console.log(module);
})